package com.itheima.search.web;

import com.itheima.item.client.ItemClient;
import com.itheima.item.pojo.GoodInfo;
import com.itheima.search.pojo.Result;
import com.itheima.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class SearchController {
    @Autowired
    private SearchService searchService;
    @Autowired
    private ItemClient itemClient;
    @PostMapping("goods/init")
    public void goodsInit(){
        searchService.export();
    }

    @PostMapping("item/search")
    public Result search(@RequestBody Map param){

        return searchService.search(param);
    }
    @GetMapping("count")
    public Integer count(){
        return itemClient.count();
    }
}
